package cn.wm.struct;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * MessageHeader
 *
 * @author wm
 * @version 1.0
 * 2021/6/24 16:26
 **/
public class MessageHeader implements Serializable {
    private static final long serialVersionUID = -237494060279204792L;
    private int magicWord;     //魔数 唯一的通信标志
    private long sessionId;    // 会话ID
    private byte type;      //消息类型
    private byte priority;      //消息优先级
    private Map<String, Object> attachment = new HashMap<String, Object>(); // 附件

    public int getMagicWord() {
        return magicWord;
    }

    public void setMagicWord(int magicWord) {
        this.magicWord = magicWord;
    }

    public long getSessionId() {
        return sessionId;
    }

    public void setSessionId(long sessionId) {
        this.sessionId = sessionId;
    }

    public byte getType() {
        return type;
    }

    public void setType(byte type) {
        this.type = type;
    }

    public byte getPriority() {
        return priority;
    }

    public void setPriority(byte priority) {
        this.priority = priority;
    }

    public Map<String, Object> getAttachment() {
        return attachment;
    }

    public void setAttachment(Map<String, Object> attachment) {
        this.attachment = attachment;
    }

    @Override
    public String toString() {
        return "MessageHeader{" +
                "magicWord=" + magicWord +
                ", sessionId=" + sessionId +
                ", type=" + type +
                ", priority=" + priority +
                ", attachment=" + attachment +
                '}';
    }
}
